package com.fanco.learn_datastruct_leetcode.designpattern.mememto.game;

/**
 * @author qiaowang 2022/2/23
 * 描述
 */
public class Client {
    public static void main(String[] args) {

        // 创建游戏角色
        GameRole gameRole = new GameRole();
        gameRole.setVit(100);
        gameRole.setDef(100);

        System.out.println("大战前的状态");
        gameRole.display();

        Caretaker caretaker = new Caretaker();
        caretaker.setMemento(gameRole.createMemento());
        gameRole.setDef(30);
        gameRole.setVit(30);

        System.out.println("大战后");
        gameRole.display();
        gameRole.recoverGameRoleFromMemento(caretaker.getMemento());
        System.out.println("恢复后");
        gameRole.display();

    }
}
